package com.wanxin.wb.common.support;



import java.util.List;

import com.alibaba.fastjson.serializer.PropertyFilter;
import com.wanxin.wb.common.support.debug.DebugUtil;
import com.wanxin.wb.common.support.exception.CodeDesc;
import com.wanxin.wb.common.support.json.IncludePropertyFilter;

import org.slf4j.Logger;

/**
 * <B>Description:</B> <br>
 * <B>Create on:</B> 2016/9/19<br>
 *
 * @author 
 * @version 1.0
 */
public abstract class BaseController {

    protected Logger logger;
    public BaseController() {
        logger = org.slf4j.LoggerFactory.getLogger(getClass());
    }

    protected String success(Object data, PropertyFilter... filters) {
        return ResultUtil.success(data,filters);
    }

    protected String success(Object data, String isSuccess, PropertyFilter... filters) {
        return ResultUtil.success(data,isSuccess,filters);
    }


    protected String fail(CodeDesc codeDesc) {
        return ResultUtil.fail(null,false);
    }

    protected String fail(CodeDesc codeDesc,Object data, PropertyFilter... filters) {
        return ResultUtil.fail(codeDesc,data,filters);
    }


    /**
     * <B>Description:</B> 生成IncludePropertyFilter<br>
     * <B>Create on:</B> 2015年4月7日 上午9:12:14<br>
     *
     * @param clazz
     * @param fields
     * @return
     * @author 
     */
    protected IncludePropertyFilter include(Class clazz, List<String> fields) {
        return ResultUtil.include(clazz, fields);
    }


    /**
     *
     * <B>Description:</B> 输出调试信息 <br>
     * <B>Create on:</B> 2015年9月12日 上午10:12:41<br>
     *
     * @param info
     * @author 
     */
    protected void addDebugInfo(String info) {
        DebugUtil.addDebugInfo(info);
    }

}
